Fixed issue when view is hidden and then re-shown - #183
Merged
Conversation
Paul Dumais (pauldumais)
requested review from
Marc-André Moreau (mamoreau-devolutions)
and
a balanced review from Copilot
and removed request for
Copilot
August 20, 2026 11:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves how
RdpClientViewmanages the lifecycle of its native control handle, especially when the control is temporarily detached (such as during docking or tab operations). The changes ensure that the native control (HWND) is not destroyed prematurely and is properly released when the view is disposed. The tests are updated to verify this new behavior.Improvements to native control lifecycle management:
detachedNativeControlfield toRdpClientViewto retain the HWND when the control is detached but not disposed, preventing premature destruction during docking or tab detachment scenarios.DestroyNativeControlCoreto retain the native control indetachedNativeControlif the view is not disposed, and only destroy it when the view is explicitly disposed.CreateNativeControlCoreto reuse the retaineddetachedNativeControlwhen reattaching, ensuring the existing session is preserved instead of creating a new one.Disposeto explicitly destroy the retained native control if it exists, ensuring proper cleanup when the view is disposed.Test coverage enhancements:
AvaloniaHosting.csto verify thatRdpClientViewproperly reuses a detached native control and correctly destroys it upon disposal, preventing resource leaks or premature destruction.